on run
	global cuenta
	global t
	set r to display dialog Â
		"How many frames to grab?" default answer "1" buttons {"Accept"} default button "Accept"
	set cuenta to ((text returned of r) as integer)
	--
	--
	set r to display dialog Â
		"Time (seconds) between shots?" default answer "10" buttons {"Accept"} default button "Accept"
	set t to ((text returned of r) as integer)
	--
	--
	if cuenta < 1 then set cuenta to 1 as integer
	if t < 1 then set t to 1 as integer
	--
	--
	--display dialog Â
	--"taking " & (cuenta as text) & " frames (" & ((t as integer) as text) & " )"
	--set t to (t * 60)
	tell application "VideoIN"
		activate
		tell application "VideoIN"
			activate
			make new document
			-- videoin full
			videoin rgb
		end tell
	end tell
	--idle
end run

on idle
	global cuenta
	global t
	if cuenta > 0 then
		tell application "VideoIN"
			videoin saveframe
		end tell
		set cuenta to (cuenta - 1)
	else
		set t to 0
	end if
	if t < 1 then
		quit of me
	end if
	return t
end idle
